Building Dynamic Web 2.0 Websites with Ruby on Rails by A. P. Rajshekhar
Author:A. P. Rajshekhar [A P Rajshekhar ]
Language: eng
Format: epub
Publisher: Packt Publishing
So we have created the two required lists. Now let us display it to the user.
Refining the View
The first step in displaying both the lists is to create a template in the app/views/users folder. Let us name it display_assign.rhtml. It will contain code to show two combo boxes—one for showing the users and another for showing the roles. Apart from that we need to give the submit button to submit the selected values to the Controller. The code is identical to what you have seen for displaying the list of genres in the 'New Tale' page. The following is the code:
<h1>Assign Role</h1> <% form_tag :action => 'assign' do %> <p><label for="user_user_name">User<br/> <select name="user"> <% @users.each do |user| %> <option value="<%= user.id %>"> <%= user.user_name %> </option> <% end %> </select> </p> <p><label for="role_role_name">Role<br/> <select name="role"> <% @roles.each do |role| %> <option value="<%= role.id %>"> <%= role.name %> </option> <% end %> </select> </p> <%= submit_tag "Assign Role" %> <% end %> <%= link_to 'Back', :action => 'list' %>
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Mikado Method by Ola Ellnestam Daniel Brolund(27120)
Hello! Python by Anthony Briggs(25975)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(25312)
Kotlin in Action by Dmitry Jemerov(24417)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(23613)
Dependency Injection in .NET by Mark Seemann(23330)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(21963)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(20868)
Grails in Action by Glen Smith Peter Ledbrook(19888)
Adobe Camera Raw For Digital Photographers Only by Rob Sheppard(17083)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(16849)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(14477)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(12597)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(11876)
A Developer's Guide to Building Resilient Cloud Applications with Azure by Hamida Rebai Trabelsi(10657)
Hit Refresh by Satya Nadella(9256)
The Kubernetes Operator Framework Book by Michael Dame(8599)
Exploring Deepfakes by Bryan Lyon and Matt Tora(8449)
Robo-Advisor with Python by Aki Ranin(8394)